<?php
/**
* @version		$Id: toolbar.config.html.php 14401 2010-01-26 14:10:00Z louis $
* @package		Joomla
* @subpackage	Config
* @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/**
* @package		Joomla
* @subpackage	Config
*/
class TOOLBAR_farm
{
	public function _DEFAULT() {

		JToolBarHelper::title( '农场管理', 'config.png' );

		$bar = & JToolBar::getInstance('toolbar');
		
		$arr = array(
			array('t' => '农地', 'c' => 'base', 'a1' => 'field', 'a2' => 'flist'),
			array('t' => '观测站', 'c' => 'base', 'a1' => 'obser', 'a2' => 'olist'),
			array('t' => '植物', 'c' => 'base', 'a1' => 'plant', 'a2' => 'plist'),
			array('t' => '病虫害', 'c' => 'base', 'a1' => 'disease', 'a2' => 'dlist'),			
			array('t' => '农药', 'c' => 'base', 'a1' => 'pesticide', 'a2' => 'pelist'),
			array('t' => '肥料', 'c' => 'base', 'a1' => 'manure', 'a2' => 'mlist'),
			array('t' => '种植计划', 'c' => 'operation', 'a1' => 'addPlantPlan', 'a2' => 'pplist'),
			array('t' => '种植记录', 'c' => 'operation', 'a1' => 'addPlantRecord', 'a2' => 'prlist'),
			array('t' => '收割记录', 'c' => 'operation', 'a1' => 'addHarvestRecord', 'a2' => 'hrlist'),
			array('t' => '环境记录', 'c' => 'operation', 'a1' => 'addEnvironmentRecord', 'a2' => 'erlist'),
			//array('t' => '种植总结', 'c' => 'sumary', 'a1' => '', 'a2' => 'plant'),
			array('t' => '种植作业总结', 'c' => 'sumary', 'a1' => '', 'a2' => 'record'),
			array('t' => '环境记录总结', 'c' => 'sumary', 'a1' => '', 'a2' => 'environment'),
		);
		
		$task = JRequest::getWord('task');
		
		foreach ($arr as $v) {
			if ($v['a1']) $bar->appendButton( 'Popup', 'new', '新增' . $v['t'], 'index.php?option=com_farm&amp;controller=' . $v['c'] . '&amp;task=' . $v['a1'], 600, 500 );
			if ($task == $v['a2'])
				JSubMenuHelper::addEntry($v['t'], 'index.php?option=com_farm&controller=' . $v['c'] . '&amp;task=' . $v['a2'], true);
			else 
				JSubMenuHelper::addEntry($v['t'], 'index.php?option=com_farm&controller=' . $v['c'] . '&amp;task=' . $v['a2']); 
		}
	}
}